package com.jic.veteran.portal.controller;

import com.google.common.collect.Maps;
import com.jic.veteran.common.api.CommonPage;
import com.jic.veteran.common.api.CommonResult;
import com.jic.veteran.model.*;
import com.jic.veteran.portal.domain.CmsArticleQueryParam;
import com.jic.veteran.portal.service.AlumniEnterpriseService;
import com.jic.veteran.portal.service.AlumniExplainService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 获取企业
 * @author mars
 * @date 2021/11/10
 */
@RestController
@Api(tags = "AlumniEnterpriseController",description = "企业信息")
@RequestMapping("/enterprise")
public class AlumniEnterpriseController {
  @Autowired
  private AlumniEnterpriseService alumniEnterpriseService;


//  @ApiOperation("查询企业列表")
//  @RequestMapping(value = "/list", method = RequestMethod.GET)
//  public CommonResult<Map<String, List<AlumniEnterpriseInformation>>> getEnterpriseList() {
//    List<AlumniEnterpriseInformation> alumniEnterpriseInformation = alumniEnterpriseService.getEnterpriseList();
//    Map<String, List<AlumniEnterpriseInformation>> map = Maps.newHashMapWithExpectedSize(20);
//    map.put("list", alumniEnterpriseInformation);
//    return CommonResult.success(map);
//  }

  @ApiOperation("查询企业列表")
  @RequestMapping(value = "/list", method = RequestMethod.GET)
  public CommonResult<CommonPage<AlumniEnterpriseInformation>> getEnterpriseList() {
    List<AlumniEnterpriseInformation> alumniEnterpriseInformation = alumniEnterpriseService.getEnterpriseList();

    return CommonResult.success(CommonPage.restPage(alumniEnterpriseInformation));
  }

  @ApiOperation("获取单个企业")
  @RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
  @ResponseBody
  public CommonResult<AlumniEnterpriseInformation> getEnterprisedDetail(@PathVariable Long id) {
    AlumniEnterpriseInformation alumniEnterpriseInformation = alumniEnterpriseService.getEnterprisedDetail(id);
    return CommonResult.success(alumniEnterpriseInformation);
  }

}
